<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('commissions', function (Blueprint $table) {
            $table->id();
            $table->foreignId('admin_id')->constrained()->onDelete('cascade');
            $table->string('top_agent')->default('超级管理员')->comment('顶级代理');
            $table->decimal('commission_top_rate', 10, 2)->comment('官方佣金比例');
            $table->decimal('commission_sup_rate', 10, 2)->nullable()->comment('上级佣金比例');
            $table->string('description', 500)->nullable()->comment('描述');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('commission');
    }
};
